@echo off
title Deploying Gen Service...
echo Deploying Gen Service...

echo RY_HOME: %~1
echo SCRIPT_HOME: %~2
cd /d "%~1\ruoyi-modules\ruoyi-gen"

echo.
echo Image Build..............
docker build -t regwmsuat.azurecr.io/ruoyi/gen:latest .

echo.
echo Image Push..............
docker push regwmsuat.azurecr.io/ruoyi/gen:latest

echo.
echo K8s Deploy..............
kubectl apply -f %~2\prod\gen\manifest.yml
kubectl rollout restart deployment ruoyi-gen -n nimbus
timeout /nobreak /t 5

echo.
echo Delete Image..............
docker rmi regwmsuat.azurecr.io/ruoyi/gen:latest
